package threadtest;


public class TestJoin {

	private static class T1 extends Thread {

		public static void main(String[] args) throws InterruptedException {
			T1 t1 = new T1();
			T2 t2 = new T2();
			t1.start();
			t1.join();
			t2.start();
		}

		@Override
		public void run() {
			int i = 1000;
			while(--i > 750) {
				try {
					sleep(10);
					System.out.println("T1");
				} catch (InterruptedException e) {
				}
			}
		}
	}

	private static class T2 extends Thread {

		@Override
		public void run() {
			int i = 1000;
			while(--i > 850) {
				try {
					sleep(10);
					System.out.println("T2");
				} catch (InterruptedException e) {
				}
			}
		}
	}
}
